<?php
namespace App\Http\Controllers\Storage;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\App\Services\StorageService;

class StorageController extends Controller
{
    /**
     * store image file as tmp file
     *
     * @param Request        $request
     * @param StorageService $storageService
     *
     * @return mixed
     */
    public function tmpUpload(Request $request, StorageService $storageService)
    {
        $image = $request->file('upfile');
        $imageUrl = $storageService->storeAsTmpImage($image);
        @unlink($image);

        return $this->respondJson(['result' => $imageUrl]);
    }
}
